﻿using Microsoft.Practices.Unity;
using RockBus.Routing.Interfaces;
using RockBus.MessageProcessors.SendPorts;

namespace RockBus.Composition
{
    public class EntLibSubscriptionCachingMsmqMessagePersistenceDependencyManager : DependencyManagerBase
    {
        protected override void FillContainer(IUnityContainer container)
        {
            this.FillContainerWithInMemoryConfigurationRespository(container);

            container
            .RegisterType<IMessageProcessor, PersistenceSendPort>(InstanceNames.PersistenceSendPort, new ContainerControlledLifetimeManager())
            .RegisterType<IMessageProcessor, DeliverySendPort>(InstanceNames.DeliverySendPort, new ContainerControlledLifetimeManager())
            .RegisterType<IMessageProcessor, InMemoryErrorProcessor>(InstanceNames.ErrorManager, new ContainerControlledLifetimeManager())
            ;
        }
    }
}